#include "GraphicsClass.h"


GraphicsClass::GraphicsClass() {
	m_D3D = 0;
}


GraphicsClass::GraphicsClass(const GraphicsClass& other) {
}


GraphicsClass::~GraphicsClass() {
}


bool GraphicsClass::Initialize(int screenWidth, int screenHeight, HWND hwnd) {
	bool result;

	// create Direct3D object
	m_D3D = new D3DClass;
	if (!m_D3D){
		return false;
	}

	// initialize Direct3D object
	result = m_D3D->Initialize(screenWidth, screenHeight, VSYNC_ENABLED, hwnd, FULL_SCREEN, SCREEN_DEPTH, SCREEN_NEAR);
	if (!result) {
		MessageBox(hwnd, L"Could not initialize Direct3D", L"Error", MB_OK);
		return false;
	}

	return true;
}


void GraphicsClass::Shutdown() {
	if (m_D3D) {
		m_D3D->Shutdown();
		delete m_D3D;
		m_D3D = 0;
	}

	return;
}


bool GraphicsClass::Frame() {
	bool result;

	//render graphics scene
	result = Render();
	if (!result) {
		return false;
	}

	return true;
}


bool GraphicsClass::Render() {
	// clear buffers to begin scene
	m_D3D->BeginScene(0.2f, 0.6f, 1.0f, 1.0f);

	// present the rendered scene to the screen
	m_D3D->EndScene();
	return true;
}